home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
076-100
/
disk_081
/
fonts
/
eric
/
test.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
3KB
|
107 lines
#include <exec/ports.h>
#include <exec/nodes.h>
#include <exec/types.h>
#include <exec/exec.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <graphics/gfxbase.h>
#include <graphics/gfx.h>
#include <graphics/text.h>
#include <graphics/regions.h>
#include <graphics/copper.h>
#include <graphics/gels.h>
#include <devices/serial.h>
#include <devices/keymap.h>
#include <hardware/blit.h>
#include <stdio.h>
#include <ctype.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
#include <devices/timer.h>
#include <exec/libraries.h>
/*
-------------------------------------------
Eric's macros, makes C into modern language
function is null - used so we have an easy
way to search for functions
-------------------------------------------
*/
#define function
#define then {
#define els } else {
#define fi }
#define rof }
#define elsif } else if
#define or ||
#define and &&
#define z if (0==1)
struct DiskfontBase *DiskfontBase;
struct GfxBase *GfxBase;
extern long *OpenLibrary();
extern struct TextFont *OpenDiskFont();
function main (argc,argv) int argc; char **argv; {
struct TextFont *fontptr;
static struct TextAttr ericfont = {(STRPTR)"ericbd.font",8L,0L,0L};
long int ecode = 0;
struct Message *m1; /* travel thru structures to the name */
struct Node *n1;
char *c1;
if (argc < 2 ) then
printf("Usage: %s fontname\n",argv[0]);
exit(20l);
els
ericfont.ta_Name = (STRPTR) argv[1];
fi
printf("replace topaz.font with |%s|\n",argv[1]);
DiskfontBase = (struct DiskfontBase *) OpenLibrary("diskfont.library",0L);
if ( DiskfontBase == NULL) then
printf("can't open disk font library\n");
ecode = 20L;
goto exiter;
fi
GfxBase = (struct GfxBase *) OpenLibrary("graphics.library",0L);
if ( GfxBase == NULL) then
printf("can't open graphics library\n");
ecode = 21L;
goto exiter;
fi
fontptr = (struct TextFont *) OpenDiskFont(&ericfont);
if (fontptr == 0) then
printf("can't open font\n");
ecode = 21L;
goto exiter;
fi
/* printf("gfxbase = %08lx %08lx\n",GfxBase,&GfxBase->TextFonts); */
/* printf("gfxbase = %08lx %08lx\n",GfxBase,&GfxBase->DefaultFont); */
/* printf("fontptr = %08lx %08lx\n",fontptr,GfxBase->TextFonts.lh_Head); */
GfxBase->TextFonts.lh_Head = (struct Node *) fontptr;
m1 = &fontptr->tf_Message; /* find name of our font */
n1 = &m1->mn_Node;
c1 = n1->ln_Name; /* address of string into c1 */
/* printf("m1 = %08lx n1 = %08lx c1 = %08lx\n",m1,n1,c1); */
GfxBase->DefaultFont = fontptr;
movmem("topaz.font",c1,(short)11); /* overwrite name of ericbd.font */
ecode = 0;
goto exiter;
exiter:
/* if (fontptr) CloseFont(fontptr); leave open forever */
if (DiskfontBase) CloseLibrary(DiskfontBase);
if (GfxBase) CloseLibrary(GfxBase);
exit(ecode);
}